<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>decltype(auto) try_operation_return_as(X) - Boost.Outcome documentation</title>
<link rel="stylesheet" href="../../css/boost.css" type="text/css">
<meta name="generator" content="Hugo 0.52 with Boostdoc theme">
<meta name="viewport" content="width=device-width,initial-scale=1.0"/>

<link rel="icon" href="../../images/favicon.ico" type="image/ico"/>
<body><div class="spirit-nav">
<a accesskey="p" href="../../reference/functions/try_operation_extract_value.html"><img src="../../images/prev.png" alt="Prev"></a>
    <a accesskey="u" href="../../reference/functions.html"><img src="../../images/up.png" alt="Up"></a>
    <a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="../../reference/functions/error_from_exception.html"><img src="../../images/next.png" alt="Next"></a></div><div id="content">
  <div class="titlepage"><div><div><h1 style="clear: both"><code>decltype(auto) try_operation_return_as(X)</code></h1></div></div></div>
  <p>This default implementation preferentially returns whatever the input type&rsquo;s <code>.as_failure()</code> member function returns.
<code>basic_result</code> and <code>basic_outcome</code> provide such a member function, see <a href="../../reference/types/basic_result/as_failure_lvalue.html" class="api-reference"><code>auto as_failure() const &amp;</code></a>
.</p>

<p>If <code>.as_failure()</code> is not available, it will also match any <code>.error()</code> member function, which it wraps into a failure type sugar using <a href="../../reference/functions/failure.html" class="api-reference"><code>failure(T &amp;&amp;, ...)</code></a>
.</p>

<p><em>Requires</em>: That the expression <code>std::declval&lt;T&gt;().as_failure()</code> and/or <code>std::declval&lt;T&gt;().error()</code> is a valid expression.</p>

<p><em>Namespace</em>: <code>BOOST_OUTCOME_V2_NAMESPACE</code></p>

<p><em>Header</em>: <code>&lt;boost/outcome/try.hpp&gt;</code></p>


        </div><p><small>Last revised: June 20, 2019 at 11:14:48 &#43;0100</small></p>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../../reference/functions/try_operation_extract_value.html"><img src="../../images/prev.png" alt="Prev"></a>
    <a accesskey="u" href="../../reference/functions.html"><img src="../../images/up.png" alt="Up"></a>
    <a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="../../reference/functions/error_from_exception.html"><img src="../../images/next.png" alt="Next"></a></div></body>
</html>
